Skip to content

[IMP] Stop indexing module prose: drop .rst, .md and .css - #2

Open
moylop260 wants to merge 1 commit into
mainfrom
main-drop-zero-value-extensions-moy
Open

[IMP] Stop indexing module prose: drop .rst, .md and .css#2
moylop260 wants to merge 1 commit into
mainfrom
main-drop-zero-value-extensions-moy

Conversation

@moylop260

Copy link
Copy Markdown
Contributor

Why

SOURCE_GLOBS had never been justified against the graph it produces. Measured on a real
Odoo 19 instance (188 modules, 5016 files, 77935 DEFINES edges), counting how many
definitions each extension contributes:

ext files definitions per file share of the graph
.py 2755 55603 20.2 71.3%
.xml 1883 14844 7.9 19.0%
.js 890 6368 7.2 8.2%
.scss 232 912 3.9 1.2%
.sql 20 35 1.8 0.04%
.csv 86 86 1.0 0.1%
.rst 73 73 1.0 0.1%
.css 8 8 1.0 0.01%
.md 2 6 3.0 0.01%

.rst and .css build exactly one node each — the File node itself, and nothing inside
it. .md only adds the headings of a README: every Section node in that graph (4 of them)
came from its two markdown files. All three are module prose, so the graph gains a path and
no structure.

What

SOURCE_GLOBS becomes .py .xml .js .scss .csv .sql. The reasoning and the measurement
live next to the constant, so the next person changing it argues with numbers.

Why .csv stays even though it scores the same 1.0

Because structure is not the only thing an indexed file is good for: search_code greps the
contents of indexed files. Searching the graph above for access_ restricted to .csv
returns 52 hits with line numbers, e.g.

extra_addons/enterprise/ai/security/ir.model.access.csv  1-14

ir.model.access.csv is a file people really do search, so dropping it would cost a real
capability to save nothing. .rst/.md/.css are greppable too, but module prose is not
what anyone greps this graph for.

Not a memory change

Worth being explicit, because it is the obvious thing to assume: this does not make a
large scope fit. The three dropped extensions are 1.4% of the files of an instance, where
.js alone is 15%. Indexing peak tracks extracted nodes, and those come overwhelmingly from
.py. This is about keeping the graph free of prose.

Verified

  • 50 tests pass, pre-commit run --all-files clean.
  • New tests pin the three exclusions, the .csv exception, and that *.scss survives — it
    ends with the same three letters as *.css, so a naive removal would take it too.
  • All the numbers above come from query_graph over a graph indexed inside the
    irc190_01 container, not from an estimate.

Every extension should earn its place by how much of the graph it builds. Measured
on a real Odoo instance (188 modules, 77935 DEFINES edges):

    .py    2755 files  55603 definitions  20.2 per file  71.3% of the graph
    .xml   1883 files  14844 definitions   7.9 per file  19.0%
    .js     890 files   6368 definitions   7.2 per file   8.2%
    .scss   232 files    912 definitions   3.9 per file   1.2%
    .csv     86 files     86 definitions   1.0 per file   0.1%
    .sql     20 files     35 definitions   1.8 per file   0.0%
    .rst     73 files     73 definitions   1.0 per file   0.1%   <- dropped
    .css      8 files      8 definitions   1.0 per file   0.0%   <- dropped
    .md       2 files      6 definitions   3.0 per file   0.0%   <- dropped

".rst" and ".css" build exactly one node each -- the File node itself and nothing
inside it. ".md" only adds the headings of a README: every Section node in that
graph came from its two markdown files. All three are module prose, so the graph
gains a path and no structure.

".csv" scores the same 1.0 and stays anyway. An indexed file is also greppable
through search_code, and ir.model.access.csv is a file people really do search:
searching the indexed graph for "access_" returns 52 hits inside csv files, with
line numbers. Structure is not the only thing an indexed file is good for.

This is about keeping the graph free of prose, not about making a scope fit: the
three dropped extensions are 1.4% of the files of an instance, where .js alone is
15%. Anyone who wants them back has --extensions.
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.86%. Comparing base (d206ab0) to head (1726a74).

Additional details and impacted files
@@            Coverage Diff             @@
##             main       #2      +/-   ##
==========================================
+ Coverage   92.73%   92.86%   +0.12%     
==========================================
  Files           6        6              
  Lines         785      799      +14     
==========================================
+ Hits          728      742      +14     
  Misses         57       57              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants